Skip to content

Add ALT+arrow word movement to Input component#533

Open
tobwen wants to merge 1 commit intoanomalyco:mainfrom
tobwen:feature/alt-arrow-word-movement
Open

Add ALT+arrow word movement to Input component#533
tobwen wants to merge 1 commit intoanomalyco:mainfrom
tobwen:feature/alt-arrow-word-movement

Conversation

@tobwen
Copy link
Copy Markdown

@tobwen tobwen commented Jan 16, 2026

Implements word-by-word cursor navigation using ALT+Left and ALT+Right:

  • Adds moveCursorWordLeft and moveCursorWordRight methods
  • Includes comprehensive test cases for various scenarios
  • Creates a demo for testing and showing compatibility
  • Handles multiple spaces and partial word positions

The implementation supports both standard terminals and PuTTY's alternative input mode (see additional fix).

Hint: Different from moveWordForward/moveWordBackward which are text-direction aware (Forward goes to logical end of text). moveWordLeft/Right are visually direction aware - Left always moves cursor visually left on screen.

Implements word-by-word cursor navigation using ALT+Left and ALT+Right:
- Adds moveCursorWordLeft and moveCursorWordRight methods
- Includes comprehensive test cases for various scenarios
- Creates a demo for testing and showing compatibility
- Handles multiple spaces and partial word positions

The implementation supports both standard terminals and PuTTY's alternative input mode (see additional fix).

Hint: Different from moveWordForward/moveWordBackward which are text-direction aware (Forward goes to logical end of text). moveWordLeft/Right are visually direction aware - Left always moves cursor visually left on screen.
@kommander
Copy link
Copy Markdown
Collaborator

I don't fully understand the difference currently. But there are word boundaries calculated natively, which support CJK/emojis etc.

@tobwen
Copy link
Copy Markdown
Author

tobwen commented Mar 9, 2026

I don't fully understand the difference currently. But there are word boundaries calculated natively, which support CJK/emojis etc.

The difference is the direction. When you say "back one word", you might navigate to the right in RTL. But when you press the cursor to the left, you might want to go to the word LEFT to the current one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants